<?php

# experimental
class SectionQuery extends Doctrine_Query {
	# experimental - automagically retrieve application and set base query for it
	public function __construct(){
		parent::__construct();
		$applicationName=sfConfig::get("sf_app");
        if ($applicationName!=""){
            $methodName="addWhere{$applicationName}";
            if (is_callable(array($this, $methodName))){
                call_user_func(array($this, $methodName));
            }
        }
	}


	public function addWherePublished(){
		return $this->addWhere("published = ?", true);
	}

    public function addWhereFrontend(){
        return $this->addWherePublished(); // entry publishing not done yet
    }
    public function addWhereBackend(){
        return $this;
    }
}